home *** CD-ROM | disk | FTP | other *** search
Text File | 2001-04-10 | 4.4 KB | 158 lines | [TEXT/ToyS] |
- global theCount
- global aRecord
- global i
-
-
- -- set appMoverName to "iView PhotoMover"
-
- on run
- set this_app to the path to frontmost application as string
- tell me to activate
-
- if AboutScript() = "Cancel" then
- tell application this_app to activate
- return -- show about
- end if
- set aRecord to {}
- set i to 1
-
- tell application "MacOS Toolbox DEBUG PPC"
- activate -- file to uploading bring to fround... afile
-
- set klog to get the Log -- Save current settings
- set ksound to get the Sound
- set kdetails to get the Details
- set khost to get the Host
-
- --set the Details to true -- Set Details to true for tracking down problems.
- set the Details to true
- set the Log to true -- save result to log file...
- set the Sound to false -- save result to log file...
-
- -- Host ID's.
- -- 0 = PhotoPoint
- -- 1 = ClubPhoto -- supports Picture Description and Album Selection (V2.0) / creation (V2.02)
- -- 2 = zing
- -- 3 = ImageStation
- -- 4 = NikonNet
- -- 5 = FotoTime -- supports Picture Description and Album Selection (V2.0) / creation (V2.02)
- set the Host to 5
-
- end tell
-
- -- get and sort only the photos with an exposure date
- tell application "iView MediaPro"
-
- if not (exists window 1) then
- beep
- tell me to activate
- display dialog "No catalogs are open! Try again." buttons {"Oops..."} default button 1 with icon stop
- tell application this_app to activate
- return
- end if
-
- tell window 1
- copy (count objects) to theCount
- if theCount = 0 then
- beep
- tell me to activate
- display dialog "No items visible in catalog! Try again." buttons {"Oops..."} default button 1 with icon stop
- tell application this_app to activate
- return
- end if
-
- try
- -- Process all selected items...
- repeat with i from 1 to theCount
-
- -------------------------------------
- -- Get file details
- set fileName to (name of object i) -- Get for reporting errors.
- set theCap to (caption of object i) -- Set theCap to the FileName.
-
- set theCountry to (country of object i)
- set theState to (state of object i)
- set theCity to (city of object i)
-
- -- logic to remove black cities and states.
- if theState = "" then
- if theCity = "" then
- set theAlbum to theCountry
- else
- set theAlbum to theCountry & " - " & theCity
- end if
- else
- if theCity = "" then
- set theAlbum to theCountry & " - " & theState
- else
- set theAlbum to theCountry & " - " & theState & " - " & theCity
- end if
- end if
-
- set AppleScript's text item delimiters to ", "
- -- Also include keywords, by removing the two '--' fields
- -- set theKeywords to (keywords of object i)
- -- set theCap to theCap & return & "Keywords: " & theKeywords as text
- --------------------------------------
-
- if the mounted of object i = true then -- only do mount items
-
- set afile to (path of object i) as alias
-
- tell application "MacOS Toolbox DEBUG PPC"
-
- try
- -- set timeout to some large number
- with timeout of 3600 seconds -- how long to upload? 1 hour?
-
- -- upload the image to the current site.
- open afile into album theAlbum with description theCap
-
- end timeout
-
- on error msg number n
- tell me to activate
- display dialog msg & "( " & n & " )" & return & ¬
- "Uploading " & return & "File: " & fileName
- exit repeat
- end try
-
- end tell -- PhotoMover
- end if -- mounted
- -- set (caption of object (aName as integer)) to newCap
- end repeat
-
- on error err_msg
- beep
- tell me to activate
- display dialog err_msg & return & "getting info.." & return & "File: " & fileName
- end try
-
- end tell -- Window 1
-
- end tell
-
- tell application "MacOS Toolbox DEBUG PPC"
- set the Log to klog -- restore the settings
- set the Sound to ksound
- set the Details to kdetails
- set the Host to khost
- end tell
- tell me to activate
-
- beep
- display dialog "Finished uploading." with icon note buttons {"Thanx"} default button 1
- tell application this_app to activate
- end run
-
- -- about this script
- on AboutScript()
- display dialog ¬
- "About \"FotoTime PhotoMover Upload script\"" & return & return & ¬
- "Upload catalog items with file name as the caption to FotoTime." & return & return ¬
- with icon note
- set theAnswer to the button returned of the result
- return theAnswer
- end AboutScript
-
-